package servlet;

import bean.Order;
import bean.OrderItem;
import service.impl.OrderItemServiceImpl;
import service.impl.OrderServiceImpl;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.List;

@WebServlet("/user/get_orderId")
public class GetOrderId extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String orderIdStr = request.getParameter("orderId");
    int orderId = Integer.parseInt(orderIdStr);
        OrderServiceImpl orderService = new OrderServiceImpl();
        Order order = orderService.getOrderById(orderId);
        request.getSession().setAttribute("order",order);
    }
}
